package com.twu.biblioteca.menuitems;

import com.twu.biblioteca.User;
import com.twu.biblioteca.menu.Menu;
import com.twu.biblioteca.menu.MenuItem;

/**
 * Created with IntelliJ IDEA.
 * User: ama
 * Date: 10/10/13
 * Time: 6:48 PM
 */
public class CheckMembershipDetailsMenuItem extends MenuItem {
    public CheckMembershipDetailsMenuItem() {
        super("M1", "Check membership details");
    }

    @Override
    public void runOption() {
        User loggedInUser = null;

        Menu.println("To log in, enter Login. Enter Cancel otherwise.");
        String userChoosesToLoginOrCancel = Menu.getInput();
        if (userChoosesToLoginOrCancel.equalsIgnoreCase("Login")) {
            loggedInUser = Menu.login();
        }

        if (loggedInUser != null) {
            Menu.println(loggedInUser.viewMembershipDetails());
        } else {
            Menu.println("Please talk to a Librarian. Thank you.");
        }
    }
}


